<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>云服务器上搭建kubernetes集群 | Alexcld</title><meta name="keywords" content="kubernetes集群搭建"><meta name="author" content="Alex"><meta name="copyright" content="Alex"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="云服务器上搭建kubernetes集群使用的虚机百度云BCC，centos7.5 ，2核4Gyum源百度云官方自带yum源，腾讯，阿里云自带yum源都可参考该文档 搭建k8，一共三台虚机： 123master 192.168.0.8		master跟etcd共用一台minion1 192.168.0.9minion2 192.168.0.10 百度云虚机自带yum源就可以下载三台虚机都需要安装 1">
<meta property="og:type" content="article">
<meta property="og:title" content="云服务器上搭建kubernetes集群">
<meta property="og:url" content="http://blogtest.alexcld.com/posts/8327.html">
<meta property="og:site_name" content="Alexcld">
<meta property="og:description" content="云服务器上搭建kubernetes集群使用的虚机百度云BCC，centos7.5 ，2核4Gyum源百度云官方自带yum源，腾讯，阿里云自带yum源都可参考该文档 搭建k8，一共三台虚机： 123master 192.168.0.8		master跟etcd共用一台minion1 192.168.0.9minion2 192.168.0.10 百度云虚机自带yum源就可以下载三台虚机都需要安装 1">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img.alexcld.com/img/231712-160450303247b9.jpg">
<meta property="article:published_time" content="2020-12-03T06:47:39.000Z">
<meta property="article:modified_time" content="2020-12-20T09:39:54.000Z">
<meta property="article:author" content="Alex">
<meta property="article:tag" content="kubernetes集群搭建">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img.alexcld.com/img/231712-160450303247b9.jpg"><link rel="shortcut icon" href="https://img.alexcld.com/img/author.png"><link rel="canonical" href="http://blogtest.alexcld.com/posts/8327"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?ed29f24d552b68e914260fcff2860767";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '云服务器上搭建kubernetes集群',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2020-12-20 17:39:54'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.2.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://img.alexcld.com/img/author.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">29</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">29</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/download"><i class="fa-fw fa fa-download"></i><span> 下载</span></a></div><div class="menus_item"><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 追剧怪</span></a></div><div class="menus_item"><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 博主</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://img.alexcld.com/img/231712-160450303247b9.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Alexcld</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/download"><i class="fa-fw fa fa-download"></i><span> 下载</span></a></div><div class="menus_item"><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 追剧怪</span></a></div><div class="menus_item"><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 博主</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">云服务器上搭建kubernetes集群</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-12-03T06:47:39.000Z" title="发表于 2020-12-03 14:47:39">2020-12-03</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2020-12-20T09:39:54.000Z" title="更新于 2020-12-20 17:39:54">2020-12-20</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2.7k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>14分钟</span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="云服务器上搭建kubernetes集群"><a href="#云服务器上搭建kubernetes集群" class="headerlink" title="云服务器上搭建kubernetes集群"></a>云服务器上搭建kubernetes集群</h1><h3 id="使用的虚机百度云BCC，centos7-5-，2核4G"><a href="#使用的虚机百度云BCC，centos7-5-，2核4G" class="headerlink" title="使用的虚机百度云BCC，centos7.5 ，2核4G"></a>使用的虚机百度云BCC，centos7.5 ，2核4G</h3><p>yum源百度云官方自带yum源，腾讯，阿里云自带yum源都可参考该文档</p>
<p>搭建k8，一共三台虚机：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">master 192.168.0.8		master跟etcd共用一台</span><br><span class="line">minion1 192.168.0.9</span><br><span class="line">minion2 192.168.0.10</span><br></pre></td></tr></table></figure>
<p>百度云虚机自带yum源就可以下载<br>三台虚机都需要安装</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# yum -y install kubernetes etcd flannel ntp</span><br><span class="line">[root@minion1 ~]# yum -y install kubernetes etcd flannel ntp</span><br><span class="line">[root@minion2 ~]# yum -y install kubernetes etcd flannel ntp</span><br></pre></td></tr></table></figure>
<p>关闭防火墙 三台同样需要关闭     注：若是生产环境不必关闭，写firewalld rule</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# systemctl stop firewalld &amp;&amp; systemctl disable firewalld &amp;&amp; systemctl status firewalld</span><br><span class="line">[root@minion1~]# systemctl stop firewalld &amp;&amp; systemctl disable firewalld &amp;&amp; systemctl status firewalld</span><br><span class="line">[root@minion2~]# systemctl stop firewalld &amp;&amp; systemctl disable firewalld &amp;&amp; systemctl status firewalld</span><br></pre></td></tr></table></figure>
<p>在hosts文件添加以下内容，执行一台，剩余拷贝就ok</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# vim &#x2F;etc&#x2F;hosts</span><br><span class="line">192.168.0.8 master</span><br><span class="line">192.168.0.8 etcd</span><br><span class="line">192.168.0.9 minion1</span><br><span class="line">192.168.0.10 minion2</span><br><span class="line">[root@master ~]# scp &#x2F;etc&#x2F;hosts 192.168.0.9:&#x2F;etc&#x2F;</span><br><span class="line">[root@master ~]# scp &#x2F;etc&#x2F;hosts 192.168.0.10:&#x2F;etc&#x2F;</span><br></pre></td></tr></table></figure>

<p>在master上配置etcd</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# vim &#x2F;etc&#x2F;etcd&#x2F;etcd.conf </span><br><span class="line">改：2 ETCD NAME&#x3D;default</span><br><span class="line">为：2ETCD_NAME&#x3D;&quot;etcd&quot;</span><br><span class="line">ETCD_DATA_DIR&#x3D;&quot;&#x2F;var&#x2F;lib&#x2F;etcd&#x2F;default.etcd&quot;</span><br><span class="line">改：9 ETCD_LISTEN_CLIENT_URLS&#x3D;&quot;http:&#x2F;&#x2F;localhost:2379&quot;</span><br><span class="line">为：ETCD_LISTEN_CLIENT_URLS&#x3D;&quot;http:&#x2F;&#x2F;localhost：2379,http:&#x2F;&#x2F;192.168.0.8:2379&quot;</span><br><span class="line">改：20 ETCD_ADVERTISE_CLIENT_URLS&#x3D;&quot;http:&#x2F;&#x2F;localhost:2379&quot;</span><br><span class="line">为：ETCD_ADVERTISE_CLIENT_URLS&#x3D;&quot;http:&#x2F;&#x2F;192.168.0.8:2379&quot;</span><br><span class="line">注释：    advertise [aedvetarz] 做广告，做宣传；通告，通知</span><br><span class="line">&#x2F;etc&#x2F;etcd&#x2F;etcd.conf 配置文件含意如下：</span><br><span class="line">ETCD_NAME&#x3D;&quot;etcd&quot;</span><br><span class="line">etcd节点名称，如果etcd 集群只有一台etcd，这一项可以注释不用配置，默认名称为			default，这</span><br><span class="line">个名宇后面会用到。</span><br><span class="line">ETCD_DATA_DIR&#x3D;&quot;&#x2F;var&#x2F;lib&#x2F;etcd&#x2F;default.etcd&quot;</span><br><span class="line">etcd 存储数据的目录</span><br><span class="line">ETCD_LISTEN_CLIENT_URLS&#x3D;&quot;http:&#x2F;&#x2F;localhost:2379,http:&#x2F;&#x2F;192.168.1.63:2379&quot;</span><br><span class="line">etcd 对外服务监听地址，一般指定2379端口，如果为0.0.0.0将会监听所有接口</span><br><span class="line">ETCD_ARGS&#x3D;&quot;&quot;</span><br></pre></td></tr></table></figure>
<p>需要额外添加的参数，可以自己添加，etcd 的所有参数可以通过etcd-h查看。<br><strong>启动服务</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# systemctl start etcd</span><br><span class="line">[root@master ~]# systemctl status etcd</span><br><span class="line">[root@master ~]# systemctl enable etcd</span><br><span class="line">[root@master ~]# netstat -anptu | grep 2379</span><br><span class="line">tcp        0      0 127.0.0.1:2379          0.0.0.0:*               LISTEN      2963&#x2F;etcd           </span><br><span class="line">tcp        0      0 192.168.0.8:2379        0.0.0.0:*               LISTEN      2963&#x2F;etcd           </span><br><span class="line">tcp        0      0 192.168.0.8:38866       192.168.0.8:2379        ESTABLISHED 2963&#x2F;etcd           </span><br><span class="line">tcp        0      0 127.0.0.1:2379          127.0.0.1:45804         ESTABLISHED 2963&#x2F;etcd           </span><br><span class="line">tcp        0      0 192.168.0.8:2379        192.168.0.8:38866       ESTABLISHED 2963&#x2F;etcd           </span><br><span class="line">tcp        0      0 127.0.0.1:45804         127.0.0.1:2379          ESTABLISHED 2963&#x2F;etcd           </span><br></pre></td></tr></table></figure>

<p>检查etcd集群列表，这里只有一台</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# etcdctl member list</span><br><span class="line">8e9e05c52164694d: name&#x3D;etcd peerURLs&#x3D;http:&#x2F;&#x2F;localhost:2380 clientURLs&#x3D;http:&#x2F;&#x2F;192.168.0.8:2379 isLeader&#x3D;true</span><br></pre></td></tr></table></figure>

<p>在master配置master<br>修改kubernetets配置文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# vim &#x2F;etc&#x2F;kubernetes&#x2F;config </span><br><span class="line">改：KUBE_MASTER&#x3D;&quot;--master&#x3D;http:&#x2F;&#x2F;127.0.0.1:8080&quot;</span><br><span class="line">为：KUBE_MASTER&#x3D;&quot;--master&#x3D;http:&#x2F;&#x2F;192.168.0.8:8080&quot;</span><br></pre></td></tr></table></figure>

<p>修改apiserver配置文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# vim &#x2F;etc&#x2F;kubernetes&#x2F;apiserver</span><br><span class="line">[root@xuegod63 ~]# vim &#x2F;etc&#x2F;kubernetes&#x2F;apiserver</span><br><span class="line">改：8 KUBE_API_ADDRESS&#x3D;&quot;--insecure-bind-address&#x3D;127.0.0.1&quot;</span><br><span class="line">为：8 KUBE_API_ADDRESS&#x3D;&quot;--insecure-bind-address&#x3D;0.0.0.0</span><br><span class="line">改：17 KUBE_ETCD_SERVERS&#x3D;&quot;--etcd-servers&#x3D;http:&#x2F;&#x2F;127.0.0.1:2379&quot;</span><br><span class="line">为：KUBE_ETCD_SERVERS&#x3D;&quot;--etcd-servers&#x3D;http:&#x2F;&#x2F;192.168.0.8:2379&quot;</span><br><span class="line">改23行：</span><br><span class="line">KUBE_ADMISSION_CONTROL&#x3D;&quot;--admission-control&#x3D;NamespaceLifecycle,NamespaceExist</span><br><span class="line">s,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota&quot;</span><br><span class="line">为：KUBE_ADMISSION_CONTROL&#x3D;&quot;--admission-control&#x3D;AlwaysAdmit&quot; #这里必须配置</span><br><span class="line">正确</span><br></pre></td></tr></table></figure>

<p>配置kube-controller-manager配置文件<br>默认不需要改动</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# cat &#x2F;etc&#x2F;kubernetes&#x2F;controller-manager </span><br></pre></td></tr></table></figure>

<p>配置kube-scheduler配置文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# vim &#x2F;etc&#x2F;kubernetes&#x2F;scheduler </span><br><span class="line">改：KUBE_SCHEDULER_ARGS&#x3D;&quot; &quot;</span><br><span class="line">为：KUBE_SCHEDULER_ARGS&#x3D;&quot;0.0.0.0&quot;</span><br></pre></td></tr></table></figure>

<p>设置etcd网络</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# etcdctl set &#x2F;k8s&#x2F;network&#x2F;config &#39;&#123;&quot;Network&quot;:&quot;10.255.0.0&#x2F;16&quot;&#125;&#39;   &#x2F;&#x2F;用于存储flanneld网络信息</span><br><span class="line">[root@master ~]# etcdctl get &#x2F;k8s&#x2F;network&#x2F;config      &#x2F;&#x2F;查看</span><br><span class="line">&#123;&quot;Network&quot;:&quot;10.255.0.0&#x2F;16&quot;&#125;</span><br></pre></td></tr></table></figure>


<p>配置flanneld服务</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# vim &#x2F;etc&#x2F;sysconfig&#x2F;flanneld </span><br><span class="line">改：4FLANNEL_ETCD_ENDPOINTS&#x3D;&quot;http:&#x2F;&#x2F;127.0.0.1:2379&quot;</span><br><span class="line">为：4FLANNEL_ETCD_ENDPOINTS&#x3D;&quot;http:&#x2F;&#x2F;192.168.0.8:2379&quot;</span><br><span class="line">改:8 FLANNEL_ETCD_PREFIX&#x3D;&quot;&#x2F;atomic.io&#x2F;network&quot;</span><br><span class="line">为：8 FLANNEL_ETCD_PREFIX&#x3D;&quot;&#x2F;k8s&#x2F;network&quot;</span><br><span class="line">#注其中&#x2F;k8s&#x2F;network 与上面 etcd 中的 Network 对应</span><br><span class="line">改：11 #FLANNEL_OPTIONS&#x3D;&quot;&quot;</span><br><span class="line">为：11 FLANNEL_OPTIONS&#x3D;&quot;--iface&#x3D;eth0&quot; #指定 通信的物理网卡</span><br><span class="line">[root@master ~]# systemctl restart flanneld.service </span><br><span class="line">[root@master ~]# systemctl status flanneld.service </span><br><span class="line">[root@master ~]# cat &#x2F;run&#x2F;flannel&#x2F;subnet.env  &#x2F;&#x2F;查看&#x2F;run&#x2F;flannel&#x2F;subnet.env 子网信息</span><br><span class="line">FLANNEL_NETWORK&#x3D;10.255.0.0&#x2F;16</span><br><span class="line">FLANNEL_SUBNET&#x3D;10.255.6.1&#x2F;24</span><br><span class="line">FLANNEL_MTU&#x3D;1472</span><br><span class="line">FLANNEL_IPMASQ&#x3D;false</span><br></pre></td></tr></table></figure>
<p>之后会有一个脚本姜subnet.env转写程一个docker的环境变量文件/run/flannel/docker<br>docker0的地址是由 /run/flannel/subnet.env 的FLANNEL_SUBENT参数决定的</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# cat &#x2F;run&#x2F;flannel&#x2F;docker </span><br><span class="line">DOCKER_OPT_BIP&#x3D;&quot;--bip&#x3D;10.255.6.1&#x2F;24&quot;</span><br><span class="line">DOCKER_OPT_IPMASQ&#x3D;&quot;--ip-masq&#x3D;true&quot;</span><br><span class="line">DOCKER_OPT_MTU&#x3D;&quot;--mtu&#x3D;1472&quot;</span><br><span class="line">DOCKER_NETWORK_OPTIONS&#x3D;&quot; --bip&#x3D;10.255.6.1&#x2F;24 --ip-masq&#x3D;true --mtu&#x3D;1472&quot;</span><br></pre></td></tr></table></figure>

<p>启动master上的4个服务</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# systemctl restart kube-apiserver kube-controller-manager kube-scheduler flanneld</span><br><span class="line">[root@master ~]# systemctl status kube-apiserver kube-controller-manager kube-scheduler flanneld</span><br><span class="line">[root@master ~]# systemctl enable kube-apiserver kube-controller-manager kube-scheduler flanneld</span><br></pre></td></tr></table></figure>

<p><strong>到此master和etcd节点配置成功</strong></p>
<p>配置minion1,采用flannel方式</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# vim &#x2F;etc&#x2F;sysconfig&#x2F;flanneld </span><br><span class="line">改：4FLANNEL_ETCD_ENDPOINTS&#x3D;&quot;http:&#x2F;&#x2F;127.0.0.1:2379&quot;</span><br><span class="line">为：4FLANNEL_ETCD_ENDPOINTS&#x3D;&quot;http:&#x2F;&#x2F;192.168.0.8:2379&quot;</span><br><span class="line">改:8 FLANNEL_ETCD_PREFIX&#x3D;&quot;&#x2F;atomic.io&#x2F;network&quot;</span><br><span class="line">为：8 FLANNEL_ETCD_PREFIX&#x3D;&quot;&#x2F;k8s&#x2F;network&quot;</span><br><span class="line">#注其中&#x2F;k8s&#x2F;network 与上面 etcd 中的 Network 对应</span><br><span class="line">改：11 #FLANNEL_OPTIONS&#x3D;&quot;&quot;</span><br><span class="line">为：11 FLANNEL_OPTIONS&#x3D;&quot;--iface&#x3D;eth0&quot; #指定 通信的物理网卡</span><br></pre></td></tr></table></figure>

<p>配置minion1上的master地址和kube-proxy</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# vim &#x2F;etc&#x2F;kubernetes&#x2F;config </span><br><span class="line">改：KUBE_MASTER&#x3D;&quot;--master&#x3D;http:&#x2F;&#x2F;127.0.01:8080&quot;</span><br><span class="line">为：KUBE_MASTER&#x3D;&quot;--master&#x3D;http:&#x2F;&#x2F;192.168.0.8:8080&quot;</span><br></pre></td></tr></table></figure>
<p>kube-proxy默认不需要改动</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# grep -v &#39;^#&#39; &#x2F;etc&#x2F;kubernetes&#x2F;proxy </span><br><span class="line">KUBE_PROXY_ARGS&#x3D;&quot;&quot;</span><br></pre></td></tr></table></figure>

<p>配置minion1 kubelet</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# vim &#x2F;etc&#x2F;kubernetes&#x2F;kubelet </span><br><span class="line">改：5 KUBELET_ADDRESS&#x3D;&quot;--address&#x3D;127.0.0.1&quot;</span><br><span class="line">为：5KUBELET_ADDRESS&#x3D;&quot;--address&#x3D;0.0.0.0&quot; #默认只监听127.0.0.1，要改成：0.0.0.0，</span><br><span class="line">因为后期要使用kubectl 远程连接到kubelet 服务上，来查看 pod 及 pod 中容器的状态。如果是 127</span><br><span class="line">就无法远程连接kubelet服务。</span><br><span class="line">改：11 KUBELET_HOSTNAME&#x3D;&quot;--hostname-override&#x3D;127.0.0.1&quot;</span><br><span class="line">为：11 KUBELET_HOSTNAME&#x3D;&quot;_-hostname-override&#x3D;minion1&quot; # minion 的主机名，设置</span><br><span class="line">成和本主机机名一样，便于识别。</span><br><span class="line">改：14 KUBELET_API_SERVER&#x3D;&quot;--api-servers&#x3D;http:&#x2F;&#x2F;127.0.0.1:8080&quot;</span><br><span class="line">为：14 KUBELET_API_SERVER&#x3D;&quot;--api-servers&#x3D;http:&#x2F;&#x2F;192.168.0.8:8080&quot; #批定 apiserver</span><br><span class="line">的地址</span><br></pre></td></tr></table></figure>

<p>启动minion1服务</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# systemctl restart flanneld kube-proxy kubelet docker</span><br><span class="line">[root@minion1 ~]# systemctl enable flanneld kube-proxy kubelet docker</span><br><span class="line">[root@minion1 ~]# systemctl status flanneld kube-proxy kubelet docker</span><br><span class="line">查看</span><br><span class="line">[root@minion1 ~]# ifconfig</span><br><span class="line">docker0: flags&#x3D;4099&lt;UP,BROADCAST,MULTICAST&gt;  mtu 1500</span><br><span class="line">        inet 10.255.90.1  netmask 255.255.255.0  broadcast 0.0.0.0</span><br><span class="line">        ether 02:42:0c:ce:9d:7d  txqueuelen 0  (Ethernet)</span><br><span class="line">        RX packets 0  bytes 0 (0.0 B)</span><br><span class="line">        RX errors 0  dropped 0  overruns 0  frame 0</span><br><span class="line">        TX packets 0  bytes 0 (0.0 B)</span><br><span class="line">        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</span><br><span class="line"></span><br><span class="line">flannel0: flags&#x3D;4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt;  mtu 1472</span><br><span class="line">        inet 10.255.90.0  netmask 255.255.0.0  destination 10.255.90.0</span><br><span class="line">        inet6 fe80::6062:c456:9093:278b  prefixlen 64  scopeid 0x20&lt;link&gt;</span><br><span class="line">        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)</span><br><span class="line">        RX packets 0  bytes 0 (0.0 B)</span><br><span class="line">        RX errors 0  dropped 0  overruns 0  frame 0</span><br><span class="line">        TX packets 3  bytes 144 (144.0 B)</span><br><span class="line">        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</span><br></pre></td></tr></table></figure>
<p>查看kube-proxy</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# netstat -antup | grep proxy</span><br><span class="line">tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      3242&#x2F;kube-proxy     </span><br><span class="line">tcp        0      0 192.168.0.9:53976       192.168.0.8:8080        ESTABLISHED 3242&#x2F;kube-proxy     </span><br><span class="line">tcp        0      0 192.168.0.9:53974       192.168.0.8:8080        ESTABLISHED 3242&#x2F;kube-proxy  </span><br></pre></td></tr></table></figure>

<p>配置minion2,采用flannel方式，和minion1配置一样<br>这里 直接将minion1的的配置文件拷贝到minion2了</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# scp &#x2F;etc&#x2F;sysconfig&#x2F;flanneld 189.168.0.10:&#x2F;etc&#x2F;sysconfig&#x2F;</span><br><span class="line">再次确认拷贝正确</span><br><span class="line">[root@minion2 ~]# grep -v &#39;^#&#39; &#x2F;etc&#x2F;sysconfig&#x2F;flanneld </span><br><span class="line"></span><br><span class="line">FLANNEL_ETCD_ENDPOINTS&#x3D;&quot;http:&#x2F;&#x2F;192.168.0.8:2379&quot;</span><br><span class="line"></span><br><span class="line">FLANNEL_ETCD_PREFIX&#x3D;&quot;&#x2F;k8s&#x2F;network&quot;</span><br><span class="line"></span><br><span class="line">FLANNEL_OPTIONS&#x3D;&quot;--iface&#x3D;eth0&quot;</span><br><span class="line">[root@minion2 ~]# systemctl start flanneld.service </span><br><span class="line">[root@minion2 ~]# ifconfig </span><br><span class="line">flannel0: flags&#x3D;4305&lt;UP,POINTOPOINT,RUNNING,NOARP,MULTICAST&gt;  mtu 1472</span><br><span class="line">        inet 10.255.50.0  netmask 255.255.0.0  destination 10.255.50.0</span><br><span class="line">        inet6 fe80::435b:45bf:df6b:58c  prefixlen 64  scopeid 0x20&lt;link&gt;</span><br><span class="line">        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)</span><br><span class="line">        RX packets 0  bytes 0 (0.0 B)</span><br><span class="line">        RX errors 0  dropped 0  overruns 0  frame 0</span><br><span class="line">        TX packets 2  bytes 96 (96.0 B)</span><br><span class="line">        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0</span><br></pre></td></tr></table></figure>

<p>配置minion2上的地址和kube-proxy<br>这里也直接拷贝minion1的配置文件了</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# scp &#x2F;etc&#x2F;kubernetes&#x2F;config 192.168.0.10:&#x2F;etc&#x2F;kubernetes&#x2F;</span><br><span class="line">[root@minion1 ~]# scp &#x2F;etc&#x2F;kubernetes&#x2F;proxy 192.168.0.10:&#x2F;etc&#x2F;kubernetes&#x2F;</span><br><span class="line">[root@minion2 ~]# systemctl start kube-proxy</span><br><span class="line">[root@minion2 ~]# netstat -anptu | grep proxy</span><br><span class="line">tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      29942&#x2F;kube-proxy    </span><br><span class="line">tcp        0      0 192.168.0.10:59170      192.168.0.8:8080        ESTABLISHED 29942&#x2F;kube-proxy    </span><br><span class="line">tcp        0      0 192.168.0.10:59168      192.168.0.8:8080        ESTABLISHED 29942&#x2F;kube-proxy    </span><br><span class="line">tcp        0      0 192.168.0.10:59166      192.168.0.8:8080        ESTABLISHED 29942&#x2F;kube-proxy    </span><br></pre></td></tr></table></figure>

<p>配置minion2 kubelet</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">[root@minion1 ~]# scp &#x2F;etc&#x2F;kubernetes&#x2F;kubelet 192.168.0.10:&#x2F;etc&#x2F;kubernetes&#x2F;</span><br><span class="line">root@192.168.0.10 password: </span><br><span class="line">kubelet                                                                                               100%  613     1.6MB&#x2F;s   00:00  </span><br><span class="line">[root@minion2 ~]# vim &#x2F;etc&#x2F;kubernetes&#x2F;kubelet </span><br><span class="line">改：KUBELET_HOSTNAME&#x3D;&quot;--hostname-override&#x3D;minion1&quot;</span><br><span class="line">为：KUBELET_HOSTNAME&#x3D;&quot;--hostname-override&#x3D;minion2&quot;</span><br><span class="line">[root@minion2 ~]# systemctl start kubelet</span><br><span class="line">[root@minion2 ~]# netstat -antup | grep 8080    &#x2F;&#x2F;查看：已建立连接</span><br><span class="line">tcp        0      0 192.168.0.10:59216      192.168.0.8:8080        TIME_WAIT   -                   </span><br><span class="line">tcp        0      0 192.168.0.10:59168      192.168.0.8:8080        ESTABLISHED 29942&#x2F;kube-proxy    </span><br><span class="line">tcp        0      0 192.168.0.10:59212      192.168.0.8:8080        ESTABLISHED 32339&#x2F;kubelet       </span><br><span class="line">tcp        0      0 192.168.0.10:59214      192.168.0.8:8080        ESTABLISHED 32339&#x2F;kubelet       </span><br><span class="line">tcp        0      0 192.168.0.10:59218      192.168.0.8:8080        ESTABLISHED 32339&#x2F;kubelet       </span><br><span class="line">tcp        0      0 192.168.0.10:59166      192.168.0.8:8080        ESTABLISHED 29942&#x2F;kube-proxy    </span><br><span class="line">tcp        0      0 192.168.0.10:59210      192.168.0.8:8080        ESTABLISHED 32339&#x2F;kubelet       </span><br><span class="line">[root@minion2 ~]# systemctl restart flanneld kube-proxy kubelet docker</span><br><span class="line">[root@minion2 ~]# systemctl enable flanneld kube-proxy kubelet docker</span><br><span class="line">[root@minion2 ~]# systemctl status flanneld kube-proxy kubelet docker</span><br></pre></td></tr></table></figure>

<p>ifconfig查看docker0 IP  minion1和minion2是不一样的</p>
<p>到master主机上查看集群运行状态</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[root@master ~]# kubectl get nodes</span><br><span class="line">NAME      STATUS    AGE</span><br><span class="line">minion1   Ready     26m</span><br><span class="line">minion2   Ready     7m</span><br></pre></td></tr></table></figure>

<p><strong>到此整个集群搭建完成</strong></p>
<blockquote>
<p>总结：kubernetes 每个节点需要启动的服务和开放端口号<br>在本实验中kubernetes4个结点一共需要启动13个服务，开6个端口号。<br>详情如下：~<br>etcd:一共1个服务 ，通讯使用 2379 端口<br>启动服务<br>[root@master（etcd）~]#systemctl restart etcd<br>master:一共4个服务，通讯使用 8080端口<br>[root@master（etcd）–]# systemctl restart kube-apiserver kube-controller-manager<br>kube-scheduler flanneld<br>minion1:一共4个服务<br>kubeproxy 监控听端口号是 10249 , kubelet 监听端口 10248、10250、10255 三个端口<br>[root@minion1 –]# systemctl restart flanneld kube-proxy kubelet docker<br>minion2:一共4个服务<br>[root@minion2 ~]# systemctl restart flanneld kube-proxy kubelet docker</p>
</blockquote>
<h3 id="点击前往作者CSDN博客"><a href="#点击前往作者CSDN博客" class="headerlink" title="点击前往作者CSDN博客"></a><a target="_blank" rel="noopener" href="https://me.csdn.net/weixin_45509582">点击前往作者CSDN博客</a></h3></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">Alex</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://blogtest.alexcld.com/posts/8327.html">http://blogtest.alexcld.com/posts/8327.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://blogtest.alexcld.com" target="_blank">Alexcld</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/kubernetes%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA/">kubernetes集群搭建</a></div><div class="post_share"><div class="social-share" data-image="https://img.alexcld.com/img/231712-160450303247b9.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/1564.html"><img class="prev-cover" src="https://img.alexcld.com/img/171302-1586077982d6cd.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">hexo-butterfly使用aplayer加载音乐页面</div></div></a></div><div class="next-post pull-right"><a href="/posts/3546.html"><img class="next-cover" src="https://img.alexcld.com/img/230851-1564153731ce2b.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">nginx反向代理+nginx性能优化配置详解</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://img.alexcld.com/img/author.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Alex</div><div class="author-info__description">children don't lie</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">29</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">29</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/alexclownfish"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/alexclownfish" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:ywz0207@163.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://vue.alexcld.com" target="_blank" title="vue站点"><i class="fab fa-vuejs"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is AKA Alex,respect yeah</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E6%90%AD%E5%BB%BAkubernetes%E9%9B%86%E7%BE%A4"><span class="toc-number">1.</span> <span class="toc-text">云服务器上搭建kubernetes集群</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E7%9A%84%E8%99%9A%E6%9C%BA%E7%99%BE%E5%BA%A6%E4%BA%91BCC%EF%BC%8Ccentos7-5-%EF%BC%8C2%E6%A0%B84G"><span class="toc-number">1.0.1.</span> <span class="toc-text">使用的虚机百度云BCC，centos7.5 ，2核4G</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%82%B9%E5%87%BB%E5%89%8D%E5%BE%80%E4%BD%9C%E8%80%85CSDN%E5%8D%9A%E5%AE%A2"><span class="toc-number">1.0.2.</span> <span class="toc-text">点击前往作者CSDN博客</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/5880.html" title="docker-compose部署java前后端分离项目"><img src="https://img.alexcld.com/img/003219-15968179390168.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="docker-compose部署java前后端分离项目"/></a><div class="content"><a class="title" href="/posts/5880.html" title="docker-compose部署java前后端分离项目">docker-compose部署java前后端分离项目</a><time datetime="2022-01-17T07:02:14.000Z" title="发表于 2022-01-17 15:02:14">2022-01-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/5877.html" title="jenkins多用户权限管理"><img src="https://img.alexcld.com/img/playpiano.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="jenkins多用户权限管理"/></a><div class="content"><a class="title" href="/posts/5877.html" title="jenkins多用户权限管理">jenkins多用户权限管理</a><time datetime="2022-01-17T06:51:58.000Z" title="发表于 2022-01-17 14:51:58">2022-01-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/undefined.html" title="声明式pipeline在k8s中完成自动部署，回滚，钉钉通知"><img src="https://img.alexcld.com/img/catgirl.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="声明式pipeline在k8s中完成自动部署，回滚，钉钉通知"/></a><div class="content"><a class="title" href="/posts/undefined.html" title="声明式pipeline在k8s中完成自动部署，回滚，钉钉通知">声明式pipeline在k8s中完成自动部署，回滚，钉钉通知</a><time datetime="2021-12-10T03:24:28.000Z" title="发表于 2021-12-10 11:24:28">2021-12-10</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/5876.html" title="jenkins自动部署版本回滚"><img src="https://img.alexcld.com/img/170734-15694024544d72.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="jenkins自动部署版本回滚"/></a><div class="content"><a class="title" href="/posts/5876.html" title="jenkins自动部署版本回滚">jenkins自动部署版本回滚</a><time datetime="2021-10-09T08:07:14.000Z" title="发表于 2021-10-09 16:07:14">2021-10-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/9424.html" title="win10下使用linux"><img src="https://img.alexcld.com/img/090412-15573638521155.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="win10下使用linux"/></a><div class="content"><a class="title" href="/posts/9424.html" title="win10下使用linux">win10下使用linux</a><time datetime="2021-10-09T08:01:06.000Z" title="发表于 2021-10-09 16:01:06">2021-10-09</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://img.alexcld.com/img/231712-160450303247b9.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By Alex</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">alexclownfish</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="chat_btn" type="button" title="rightside.chat_btn"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'rdtTOtMkfivtPvkQaaDXmJUd-gzGzoHsz',
      appKey: 'E68vw0GUqAynKmIiHtw9FLRA',
      placeholder: '留下你的看法吧！！',
      avatar: 'monsterid',
      meta: 'nick,mail,link'.split(','),
      pageSize: '10',
      lang: 'zh-CN',
      recordIP: true,
      serverURLs: '',
      emojiCDN: '',
      emojiMaps: "",
      enableQQ: true,
      path: window.location.pathname,
      requiredFields: ["nick,mail"],
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !false) {
  if (false) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js" data-mobile="false" data-text="I,LOVE,YOU" data-fontsize="15px" data-random="false" async="async"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start -->
  <script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/hexo-github-calendar@1.21/hexo_githubcalendar.js"></script>
  <script data-pjax>
        function GithubCalendarConfig(){
            var git_githubapiurl ="https://python-github-calendar-api.vercel.app/api?alexclownfish";
            var git_color =['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f'];
            var git_user ="alexclownfish";
            var parent_div_git = document.getElementById('recent-posts');
            var git_div_html = '<div class="recent-post-item" style="width:100%;height:auto;padding:10px;"><div id="github_loading" style="width:10%;height:100%;margin:0 auto;display: block"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></div><div id="github_container"></div></div>';
            if(parent_div_git && location.pathname =='/'){
                console.log('已挂载github calendar')
                // parent_div_git.innerHTML=git_div_html+parent_div_git.innerHTML // 无报错，但不影响使用(支持pjax跳转)
                parent_div_git.insertAdjacentHTML("afterbegin",git_div_html) // 有报错，但不影响使用(支持pjax跳转)
            };
            GithubCalendar(git_githubapiurl,git_color,git_user)
        }
        if(document.getElementById('recent-posts')){
            GithubCalendarConfig()
        }
    </script>
    <style>#github_container{min-height:280px}@media screen and (max-width:650px) {#github_container{background-image:;min-height:0px}}</style>
    <style></style><!-- hexo injector body_end end --><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"model":{"jsonPath":"/live2dw/assets/tororo.model.json"},"display":{"position":"left","width":150,"height":300},"mobile":{"show":true},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body></html>